package com.software.cm.spring.dao;

import com.software.cm.spring.model.Employee;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;


/**
 * Created by mcan on 29/11/2014.
 */

@Repository
public class EmployeeDAO {
    @Autowired
    private SessionFactory sessionFactory;

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    public void register(Employee emp)
    {
        getSessionFactory().getCurrentSession().save(emp);
    }
}
